home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
clipexam
/
clipexam.frm
< prev
next >
Wrap
Text File
|
1994-05-16
|
7KB
|
231 lines
VERSION 2.00
Begin Form frmClip
BackColor = &H00C0C0C0&
BorderStyle = 3 'Fixed Double
Caption = "VB Window Clipping Example"
ClientHeight = 4530
ClientLeft = 2250
ClientTop = 2025
ClientWidth = 4560
Height = 4935
Left = 2190
LinkTopic = "Form1"
ScaleHeight = 4530
ScaleWidth = 4560
Top = 1680
Width = 4680
Begin Frame Frame2
BackColor = &H00C0C0C0&
Height = 615
Left = 120
TabIndex = 15
Top = 3840
Width = 4335
Begin Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Internet: gardiner@cssip.edu.au"
Height = 195
Left = 720
TabIndex = 13
Top = 360
Width = 2745
End
Begin Label Label6
AutoSize = -1 'True
BackColor = &H00C0C0C0&
BackStyle = 0 'Transparent
Caption = "Written by David Gardiner, 13th April, 1994"
Height = 195
Left = 240
TabIndex = 14
Top = 120
Width = 3690
End
End
Begin Frame Frame1
BackColor = &H00C0C0C0&
Caption = "Current Clipping"
Height = 1935
Left = 120
TabIndex = 0
Top = 120
Width = 1935
Begin Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Left"
Height = 195
Left = 240
TabIndex = 1
Top = 360
Width = 345
End
Begin Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Top"
Height = 195
Left = 240
TabIndex = 2
Top = 720
Width = 345
End
Begin Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Right"
Height = 195
Left = 240
TabIndex = 3
Top = 1080
Width = 465
End
Begin Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Bottom"
Height = 195
Left = 240
TabIndex = 4
Top = 1440
Width = 600
End
Begin Label LeftLabel
Alignment = 1 'Right Justify
BorderStyle = 1 'Fixed Single
Caption = "Label1"
Height = 225
Left = 1080
TabIndex = 5
Top = 360
Width = 615
End
Begin Label TopLabel
Alignment = 1 'Right Justify
BorderStyle = 1 'Fixed Single
Caption = "Label2"
Height = 225
Left = 1080
TabIndex = 6
Top = 720
Width = 615
End
Begin Label RightLabel
Alignment = 1 'Right Justify
BorderStyle = 1 'Fixed Single
Caption = "Label3"
Height = 225
Left = 1080
TabIndex = 7
Top = 1080
Width = 615
End
Begin Label BottomLabel
Alignment = 1 'Right Justify
BorderStyle = 1 'Fixed Single
Caption = "Label4"
Height = 225
Left = 1080
TabIndex = 9
Top = 1440
Width = 615
End
End
Begin CommandButton Command3
Caption = "&Restore Default"
Height = 375
Left = 2880
TabIndex = 11
Top = 1200
Width = 1575
End
Begin CommandButton Command2
Caption = "&Clip to Window"
Height = 375
Left = 2880
TabIndex = 10
Top = 720
Width = 1575
End
Begin CommandButton Command1
Caption = "&Ok"
Height = 375
Left = 2880
TabIndex = 8
Top = 120
Width = 1575
End
Begin Label Label8
Alignment = 2 'Center
Caption = "Public Domain. Please acknowledge use of this
code if used in your program(s)."
Height = 495
Left = 120
TabIndex = 16
Top = 3360
Width = 4335
End
Begin Label Label5
BackColor = &H00C0C0C0&
BackStyle = 0 'Transparent
Caption = "This little program shows how to use the Windows
API calls to clip the cursor to the current form. You could clip to any area
you wanted, though make sure that you restore the clipping to the default
(whole screen) on exit."
Height = 975
Left = 120
TabIndex = 12
Top = 2280
Width = 4350
End
End
Option Explicit
Sub Command1_Click ()
' restore clip to what it was at start up
Call ClipCursorToScreen
' exit
End
End Sub
Sub Command2_Click ()
' Clip to form's window
Call ClipCursorToWindow(frmClip.hWnd)
' display coordinates
Call ShowCurrentRect
End Sub
Sub Command3_Click ()
' restore clip to whole screen
Call ClipCursorToScreen
' display
Call ShowCurrentRect
End Sub
Sub Form_Load ()
' display these
Call ShowCurrentRect
End Sub
Sub ShowCurrentRect ()
Dim r As RECT
'get current clipping region
Call GetClipCursor(r)
LeftLabel.Caption = Str$(r.Left)
TopLabel.Caption = Str$(r.top)
RightLabel.Caption = Str$(r.Right)
BottomLabel.Caption = Str$(r.Bottom)
End Sub